Problem Note 39461: Courier New font might display incorrectly in an RTF file created with the RTF tagset
When an RTF file created with the RTF tagset is displayed in Microsoft Word, the Font drop-down box will contain "Courier New" as the value of the font being used. However, the font in the table cells will not actually display as Courier New.
This problem is most likely to occur when all of the following are true:
- The DBCS option is in effect.
- The locale is English.
- The Courier New font is requested in a style created by PROC TEMPLATE.
- No PARENT is specified in the style template.
The code below generates a problematic RTF file. To circumvent the problem, generate the RTF file with no leading spaces in the font name in the header of the RTF file. Please see the code in the Full Code tab for an example.
proc template;
define style test;
style fonts / "XFont" = ("Courier New",9pt);
style Container / font = Fonts('XFont');
end;
run;
quit;
data a;
a="AAAA";
run;
ods listing close;
ods tagsets.rtf file="test.rtf" style=test;
proc print data=a;
run;
ods tagsets.rtf close;
ods listing;
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft Windows XP 64-bit Edition | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft® Windows® for x64 | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft Windows Server 2008 | 9.2 TS2M2 | 9.3 TS1M0 |
Microsoft Windows XP Professional | 9.2 TS2M2 | 9.3 TS1M0 |
Windows 7 Enterprise 32 bit | 9.2 TS2M2 | 9.3 TS1M0 |
Windows 7 Enterprise x64 | 9.2 TS2M2 | 9.3 TS1M0 |
Windows 7 Home Premium 32 bit | 9.2 TS2M2 | 9.3 TS1M0 |
Windows 7 Home Premium x64 | 9.2 TS2M2 | 9.3 TS1M0 |
Windows 7 Professional 32 bit | 9.2 TS2M2 | 9.3 TS1M0 |
Windows 7 Professional x64 | 9.2 TS2M2 | 9.3 TS1M0 |
Windows 7 Ultimate 32 bit | 9.2 TS2M2 | 9.3 TS1M0 |
Windows 7 Ultimate x64 | 9.2 TS2M2 | 9.3 TS1M0 |
Windows Vista | 9.2 TS2M2 | 9.3 TS1M0 |
64-bit Enabled AIX | 9.2 TS2M2 | 9.3 TS1M0 |
64-bit Enabled HP-UX | 9.2 TS2M2 | 9.3 TS1M0 |
64-bit Enabled Solaris | 9.2 TS2M2 | 9.3 TS1M0 |
HP-UX IPF | 9.2 TS2M2 | 9.3 TS1M0 |
Linux | 9.2 TS2M2 | 9.3 TS1M0 |
Linux for x64 | 9.2 TS2M2 | 9.3 TS1M0 |
OpenVMS on HP Integrity | 9.2 TS2M2 | 9.3 TS1M0 |
Solaris for x64 | 9.2 TS2M2 | 9.3 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
The following code generates font information in the RTF file that looks like this:
{\f2\fmodern\fprq1\fcharset0{\*\panose 02070309020205020404}Courier New;}
Instead of this:
{\f2\fmodern\fprq1\fcharset0{\*\panose 02070309020205020404} Courier New;}
This will result in the RTF file correctly displaying the Courier New font when opened in Microsoft Word.
proc template;
edit tagsets.rtf;
define event addfont;
start:
open font_tbl;
do /if ^cmp( $lcid, "1033");
eval $newfam RTFENCODE($bestfam[LABEL]);
eval $newcode RTFENCODE(CODE);
eval $newcodebase RTFENCODE(CODEBASE);
put "{\f" LIST_INDEX $newfam "\fcharset" $newcode "\cpg" $
newcodebase;
/* VALUE is the font name */
eval $newvalue RTFENCODE(VALUE);
do/if TEXT;
/* We can get the panose for a Trutype Font as TEXT */
eval $newtext RTFENCODE(TEXT);
put "{\*\panose " $newtext "}" $newvalue ";}" NL;
else ;
put " " $newvalue ";}" NL;
done;
else;
do /if CODEBASE;
put "{\f" LIST_INDEX $bestfam[LABEL ] "\fcharset" CODE "\cpg"
CODEBASE;
else;
put "{\f" LIST_INDEX $bestfam[LABEL ] "\fcharset0";
done;
do/if TEXT;
put "{\*\panose " TEXT "}" VALUE ";}" NL;
else ;
put " " VALUE ";}" NL;
done;
done;
close;
end;
end;
run;
proc template;
define style test;
style fonts / "XFont" = ("Courier New",9pt);
style Container / font = Fonts('XFont');
end;
run;
quit;
data a;
a="AAAA";
run;
ods tagsets.rtf style=test file="&sysver.%sysfunc(getoption(locale)).updatedtagset.rtf";
ods listing close;
proc print data=a;
run;
ods _all_ close;
ods listing;
The Courier New font might display incorrectly in an RTF file created with the RTF tagset.
Type: | Problem Note |
Priority: | medium |
Date Modified: | 2010-05-19 11:18:25 |
Date Created: | 2010-04-27 15:40:57 |